<?php
    $input = fopen("img.jpg", "r");
    $data = fread($input, filesize("img.jpg"));
    
    $output = fopen("img.base64", "w");
    fwrite($output, base64_encode($data)); 
?>
